package com.situ.skymallproductreviewapi.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.situ.model.ProductReview;
import com.situ.service.ProductReviewService;
import com.situ.skymallproductreviewapi.dao.ProductReviewMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ProductReviewServiceImpl implements ProductReviewService {
    ProductReviewMapper productReviewMapper;

    @Autowired
    public void setProductReviewMapper(ProductReviewMapper productReviewMapper) {
        this.productReviewMapper = productReviewMapper;
    }


    @Override
    public Page<ProductReview> findAll(Page<ProductReview> page, ProductReview productReview) {
        return productReviewMapper.findAll(page, productReview);
    }



    @Override
    public Boolean save(ProductReview productReview) {
        return productReviewMapper.insert(productReview) ==1;
    }


    @Override
    public boolean update(ProductReview productReview) {
        return productReviewMapper.updateById(productReview) == 1;
    }

    @Override
    public int deleteByIds(List<Integer> ids) {
        return productReviewMapper.deleteByIds(ids);
    }

    @Override
    public Map<String, Object> stateByProductId(Integer ProductId) {
        return productReviewMapper.stateByProductId(ProductId);
    }
}
